package com.example.util;

/**
 * Created by js18 on 2017/5/25.
 */
public interface BaseEnum {
    String getDescription();

    Integer getValue();

    static <E extends Enum<?> & BaseEnum> E fromValue(Class<E> enumClass, int value) {
        E[] enumConstants = enumClass.getEnumConstants();
        for (E e : enumConstants) {
            if (e.getValue() == value)
                return e;
        }
        return null;
    }


}
